function showMap() {
    $("#gmap").css("overflow","hidden");
    initialize();
}

function show(what) {
    $("#gmap").css("overflow","hidden");
    $("#gmap").html("<div class='container' style='height: 100%;'><iframe src='../"+what+".html' class='iframe'></iframe></div>");
}

function showEvent(index) {
    $("#gmap").css("overflow","auto");
    
    var html = "<div class='container' style='background-color:white;padding:50px;width:840px;'>";
    html += "<button onclick='showMap()'>Zpět na přehled nehod</button>";
    html += "<h3>Detail nehody</h3>";
    
    html += "<h4>Informace</h4>";
    html += "<p>"+events[index].descLong+"</p><br>";
    
    html += "<h4>Místo nehody</h4>";
    html += "<p>"+events[index].position+"</p><br>";
    
    html += "<h4>StreetView místa nehody</h4><div id='sv' style='width:840px;height: 300px'></div><br>";
    
    html += "<h4>Aktuální počasí v místě nehody</h4>";
    html += "<div id='weather'></div><br>";
    html += "</div>";
    $("#gmap").html(html);
    
    
    //weather
    var url = "http://api.openweathermap.org/data/2.5/weather?lat="+events[index].lat+"&lon="+events[index].lng;
    $.getJSON(url + "&callback=?", null, function(data) {
        var weather_text = "<img src='http://openweathermap.org/img/w/"+data.weather[0].icon+".png'> <br>";
        weather_text += "popis: <strong>"+data.weather[0].description+"</strong><br>";
        weather_text += "teplota: <strong>"+parseInt(data.main.temp-273.15)+" °C</strong><br>";
        weather_text += "vlhkost vzduchu: <strong>"+data.main.humidity+" %</strong><br>";
        
        $("#weather").html(weather_text);
    });
    
    
    
    //streetview
    var fenway = new google.maps.LatLng(events[index].lat,events[index].lng);
    var panoOptions = {
      position: fenway,
      addressControlOptions: {
        position: google.maps.ControlPosition.BOTTOM_CENTER
      },
      linksControl: false,
      panControl: true,
      zoomControlOptions: {
        style: google.maps.ZoomControlStyle.SMALL
      },
      enableCloseButton: false
    };
    var panorama = new google.maps.StreetViewPanorama(document.getElementById('sv'), panoOptions);
  
}